package PIPL::System::ConfigTest;

use strict;

use base 'Test::Unit::TestCase';

use PIPL::System::Config;

sub new {
    my $self = shift()->SUPER::new(@_);
    return $self;
}

sub test_PIPL_System_Config_new {
    my $self = shift;
    my $obj1 = PIPL::System::Config->new;
    $self->assert_not_null($obj1);
    $self->assert($obj1->isa('PIPL::System::Config'));
    my $obj2 = $obj1->new;
    $self->assert_not_null($obj2);
    $self->assert($obj2->isa('PIPL::System::Config'));
}

sub test_PIPL_System_Config_instance {
    my $self = shift;
    PIPL::System::Config->destroy;
    my $obj1 = PIPL::System::Config->instance;
    my $obj2 = PIPL::System::Config->instance;
    $self->assert_not_null($obj1);
    $self->assert_not_null($obj2);
    $self->assert($obj1->isa('PIPL::System::Config'));
    $self->assert($obj2->isa('PIPL::System::Config'));
    $self->assert_equals($obj1, $obj2);
}

sub test_PIPL_System_Config_Self {
    my $self = shift;
    my $version = sprintf "%vd", $^V;
    $self->assert($version);
    $self->assert_not_null($PIPL::System::Config::Self->{'version'});
    $self->assert_equals($version, $PIPL::System::Config::Self->{'version'});
    my $obj = PIPL::System::Config->instance;
    $self->assert_not_null($obj);
    $self->assert($obj->isa('PIPL::System::Config'));
    $self->assert_not_null($obj->{'version'});
    $self->assert_equals($version, $obj->{'version'});
}

1;
